<template>
<div class="app-container calendar-list-container">
  <div class="content-container">
          <div style="overflow:hidden">
              <el-col :span="16" style='margin-top:15px;'>
                  <el-form :label-position="labelPosition">
                      <el-form-item>
                            <el-input
                              type="textarea"
                              :autosize="{ minRows: 23, maxRows: 25}"
                              placeholder="请输入客户端协议"
                              v-model="protocol.protocol">
                            </el-input>
                      </el-form-item>
                  </el-form>
              </el-col>
          </div>
          
          <div>
            <el-button @click="protocol.protocol= ''">清空</el-button>
            <el-button type="primary" @click="update">保存</el-button>
          </div>
          <div style="margin-top:20px">
            <span style="color:#ff0000">*</span>
            <span style="color:#bdbdbd">注: 清空之后需要保存才能生效</span>
          </div>
          
        </div>
    </div>
</template>

<script>
import { item, addOrUpdate } from "@/api/protocol/index";
export default {
  name: "user",
  data() {
    return {
      protocol: {
        protocol: "",
        id: undefined,
        name: "客户端协议"
      },
      phoneDisable: false,
      imageUrl: "",
      dataObj: { token: "", key: "" },
      operateArray: [
        {
          id: 0,
          name: "直营店"
        },
        {
          id: 1,
          name: "加盟店"
        },
        {
          id: 2,
          name: "协议店"
        }
      ],
      province: "",
      city: "",
      area: "",
      street: "",
      labelPosition: "right",
      formStatus: "create",
      form: {
        username: undefined,
        name: undefined,
        sex: "男",
        password: undefined,
        description: undefined
      },
      rules: {},
      list: null,
      total: null,
      listLoading: true,
      listQuery: {
        pageNo: 1,
        pageSize: 20
      },
      sexOptions: ["男", "女"],
      dialogFormVisible: false,
      dialogStatus: "",
      userManager_btn_edit: true,
      userManager_btn_del: true,
      userManager_btn_add: true,
      textMap: {
        update: "编辑",
        create: "创建"
      },
      tableKey: 0,
      provinceList: [],
      cityList: [],
      areaList: [],
      streetList: [],
      image: "",
      file: "",
      shopInfo: {
        id: null,
        phone: "",
        name: "",
        provinceId: 355,
        cityId: 356,
        areaId: 357,
        streetId: 358,
        slogan: null,
        description: null,
        shopkeeper: "",
        userId: null,
        longtitude: null,
        latitude: null,
        operateType: 0
      }
    };
  },
  created() {
    //加载客户端协议
    var param = { type: 0 };
    item(param).then(resp => {
      this.protocol = resp.data;
    });
  },
  computed: {},
  methods: {
    update() {
      addOrUpdate(this.protocol).then(resp => {
        if (resp.status == 200) {
          this.$message({
            message: resp.message,
            type: "success"
          });
        } else {
          this.$message.error(resp.message);
        }
      });
    }
  }
};
</script>
<style scoped>
.content-left {
  float: left;
}
.content-right {
  height: 100px;
  border: 1px solid #ff0000;
  float: left;
  margin-left: 20px;
}

.tip {
  padding: 8px 16px;
  background-color: #f5f5f5;
  border-left: 5px solid #42b983;
  margin: 20px 0;
  color: #757575;
}

.avatar {
  width: 180px;
  height: 180px;
}
</style>